#include "namedPipe.hpp"


//server：read

int main()
{
    NamePiped fifo(comm_path,Creater);
    if(fifo.OpenForRead())
    {
        //std::cout << "please commect !" << std::endl;

        while (true)
        {
            std::string message;
            int n = fifo.ReadPipe(&message);
            if(n > 0)
            {
                std::cout << message << std::endl;
            }
            else if(n == 0)
            {
                //std::cout << "client quit , server quit too! " << std::endl;
                break;
            }
            else
            {
                //std::cout << "client error , server quit! " << std::endl;
                break;
            }
        }
    }
    return 0;
}